home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 March / PCWorld_2007-03_cd.bin / domacnost a kancelar / scribus / scribus-1.3.3.7-win32-install.exe / lib / encodings / tis_620.py < prev    next >
Text File  |  2004-08-07  |  1KB  |  47 lines

  1. """ Python Character Mapping Codec for TIS-620.
  2.  
  3.     According to
  4.     ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-11.TXT the
  5.     TIS-620 is the identical to ISO_8859-11 with the 0xA0 (no-break
  6.     space) mapping removed.
  7.  
  8. """#"
  9.  
  10. import codecs
  11. from encodings.iso8859_11 import decoding_map
  12.  
  13. ### Codec APIs
  14.  
  15. class Codec(codecs.Codec):
  16.  
  17.     def encode(self,input,errors='strict'):
  18.  
  19.         return codecs.charmap_encode(input,errors,encoding_map)
  20.  
  21.     def decode(self,input,errors='strict'):
  22.  
  23.         return codecs.charmap_decode(input,errors,decoding_map)
  24.  
  25. class StreamWriter(Codec,codecs.StreamWriter):
  26.     pass
  27.  
  28. class StreamReader(Codec,codecs.StreamReader):
  29.     pass
  30.  
  31. ### encodings module API
  32.  
  33. def getregentry():
  34.  
  35.     return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
  36.  
  37. ### Decoding Map
  38.  
  39. decoding_map = decoding_map.copy()
  40. decoding_map.update({
  41.         0x00a0: None,
  42. })
  43.  
  44. ### Encoding Map
  45.  
  46. encoding_map = codecs.make_encoding_map(decoding_map)
  47.